package com.msb.dongbao.ums;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.core.io.ClassPathResource;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

import java.util.Properties;

/**
 * @author: may
 * @date: 2021年05月29日 16:24
 */
@SpringBootApplication
@MapperScan("com.msb.dongbao.ums.mapper")
public class MsbDongbaoUmsApplication {
    public static void main(String[] args) {
        SpringApplication.run(MsbDongbaoUmsApplication.class, args);
//        YamlPropertiesFactoryBean yamlMapFactoryBean = new YamlPropertiesFactoryBean();
////可以加载多个yml文件
//        yamlMapFactoryBean.setResources(new ClassPathResource("application.yml"));
//        Properties properties = yamlMapFactoryBean.getObject();
//
////获取yml里的参数
//        String active = properties.getProperty("spring.profiles.active");
//        String property = properties.getProperty("spring.datasource.username");
//        System.out.println("active:"+active);
//        System.out.println("active:"+property);
    }

    @Bean
    public PasswordEncoder passwordEncoder() {
        return new BCryptPasswordEncoder();
    }
}
